#include "SemanticNodeBlockExecute.h"
#include "SemanticNodeMethodBody.h"
/**
 *  @fn	SemanticNodeBlockExecute::SemanticNodeBlockExecute(const SyntaxTreeNode *executeNodeParent,
 *  	SemanticNode *parent)
 *
 *  @brief	Constructor.
 *
 *  @author	Hrvoje Torbasinovic
 *
 */
SemanticNodeBlockExecute::SemanticNodeBlockExecute(const SyntaxTreeNode *executeNodeParent, SemanticNode *parent) : SemanticNode(parent), LabeledNode(executeNodeParent->Nodes->GetData(0)) {
	const SyntaxTreeNode *theNode = executeNodeParent->Nodes->GetData(1)->Nodes->GetData(0);
	body = new SemanticNodeMethodBody(theNode->Nodes->GetData(2), this);
}

SemanticNodeBlockExecute::~SemanticNodeBlockExecute(){
	delete body;
	body = NULL;
}

std::string SemanticNodeBlockExecute::toDebugString(int tab) {
	std::ostringstream res;
	for (int i = 0; i < tab; i++)	res << DEBUG_STRING_RAZMAK;
	res << getLabelsDebugString() << ": execute " << std::endl;
	res << body->toDebugString(tab + 1);
	return res.str();
}
